package com.zhanghp;

/**
 * @author zhanghp
 * @date 2022-08-26 10:49
 */
public enum WeatherType {

    SUNNY("Sunny"),
    RAINY("Rainy"),
    WINDY("Windy"),
    COLD("Cold");

    private final String description;

    WeatherType(String description) {
        this.description = description;
    }

    public static void main(String[] args) {
        System.out.println(WeatherType.COLD);
        WeatherType weatherType = SUNNY;
        System.out.println(weatherType.getDescription());
        var enumValues = WeatherType.values();
        System.out.println(SUNNY.ordinal());
        System.out.println(enumValues.length);
        System.out.println((SUNNY.ordinal() + 1) % enumValues.length);
        weatherType = enumValues[(SUNNY.ordinal() + 1) % enumValues.length];
        System.out.println(weatherType.getDescription());
        System.out.println("--");
        System.out.println(enumValues[0].getDescription());
        System.out.println(1 % 4);
        System.out.println(2 % 4);
        System.out.println(3 % 4);
        System.out.println(4 % 4);
        System.out.println(1 / 4);
    }

    public String getDescription() {
        return this.description;
    }

    @Override
    public String toString() {
        return this.name().toLowerCase();
    }
}
